<?php
/**
 * Created by PhpStorm.
 * User: ASUS
 * Date: 2016/10/30
 * Time: 10:53
 */
header('content-type:text/html;charset=utf-8');
require '.idea/public_function.php';
dbInit();
if(!empty($_POST)){
    $fields=array('e_name','e_dept','date_of_birth','date_of_entry');
    $value=array();
    foreach($fields as $k => $v){
        $data=isset($_POST[$v]) ? $_POST[$v] : '';
        if($data='') die($v.'字段不能为空');
        $data=safeHandle($data);
        $fields[$k]="'$v'";
        $values="'$data'";

    }
    $fiedls=implode(',','$fields');
    $values=implode(',','$values');
    $sql="insert into `emp_info` ($fields) values ($values) ";
    if($resilt= query($sql)){
        header('Location:./showlist.php');
        die;
    }else{
        die('员工添加失败!');
    }
}
define('APP','itcast');
require './add_html.php';